<?php


abstract class BaseCompanyShadow extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $company_id;


	
	protected $name;


	
	protected $namehebrew;


	
	protected $description;


	
	protected $author_id;


	
	protected $founded;


	
	protected $email;


	
	protected $location;


	
	protected $url;


	
	protected $slug;


	
	protected $blogurl;


	
	protected $rssurl;


	
	protected $twitteruser;


	
	protected $phonenumber;


	
	protected $emailcontact;


	
	protected $rounds;


	
	protected $founders;


	
	protected $numberemploy;


	
	protected $logourl;


	
	protected $publishstate;


	
	protected $version;


	
	protected $status;


	
	protected $created_at;


	
	protected $updated_at;

	
	protected $aCompany;

	
	protected $aUser;

	
	protected $collCompanys;

	
	protected $lastCompanyCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getCompanyId()
	{

		return $this->company_id;
	}

	
	public function getName()
	{

		return $this->name;
	}

	
	public function getNamehebrew()
	{

		return $this->namehebrew;
	}

	
	public function getDescription()
	{

		return $this->description;
	}

	
	public function getAuthorId()
	{

		return $this->author_id;
	}

	
	public function getFounded()
	{

		return $this->founded;
	}

	
	public function getEmail()
	{

		return $this->email;
	}

	
	public function getLocation()
	{

		return $this->location;
	}

	
	public function getUrl()
	{

		return $this->url;
	}

	
	public function getSlug()
	{

		return $this->slug;
	}

	
	public function getBlogurl()
	{

		return $this->blogurl;
	}

	
	public function getRssurl()
	{

		return $this->rssurl;
	}

	
	public function getTwitteruser()
	{

		return $this->twitteruser;
	}

	
	public function getPhonenumber()
	{

		return $this->phonenumber;
	}

	
	public function getEmailcontact()
	{

		return $this->emailcontact;
	}

	
	public function getRounds()
	{

		return $this->rounds;
	}

	
	public function getFounders()
	{

		return $this->founders;
	}

	
	public function getNumberemploy()
	{

		return $this->numberemploy;
	}

	
	public function getLogourl()
	{

		return $this->logourl;
	}

	
	public function getPublishstate()
	{

		return $this->publishstate;
	}

	
	public function getVersion()
	{

		return $this->version;
	}

	
	public function getStatus()
	{

		return $this->status;
	}

	
	public function getCreatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->created_at === null || $this->created_at === '') {
			return null;
		} elseif (!is_int($this->created_at)) {
						$ts = strtotime($this->created_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
			}
		} else {
			$ts = $this->created_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getUpdatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->updated_at === null || $this->updated_at === '') {
			return null;
		} elseif (!is_int($this->updated_at)) {
						$ts = strtotime($this->updated_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true));
			}
		} else {
			$ts = $this->updated_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function setId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::ID;
		}

	} 
	
	public function setCompanyId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->company_id !== $v) {
			$this->company_id = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::COMPANY_ID;
		}

		if ($this->aCompany !== null && $this->aCompany->getId() !== $v) {
			$this->aCompany = null;
		}

	} 
	
	public function setName($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->name !== $v) {
			$this->name = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::NAME;
		}

	} 
	
	public function setNamehebrew($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->namehebrew !== $v) {
			$this->namehebrew = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::NAMEHEBREW;
		}

	} 
	
	public function setDescription($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->description !== $v) {
			$this->description = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::DESCRIPTION;
		}

	} 
	
	public function setAuthorId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->author_id !== $v) {
			$this->author_id = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::AUTHOR_ID;
		}

		if ($this->aUser !== null && $this->aUser->getId() !== $v) {
			$this->aUser = null;
		}

	} 
	
	public function setFounded($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->founded !== $v) {
			$this->founded = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::FOUNDED;
		}

	} 
	
	public function setEmail($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->email !== $v) {
			$this->email = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::EMAIL;
		}

	} 
	
	public function setLocation($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->location !== $v) {
			$this->location = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::LOCATION;
		}

	} 
	
	public function setUrl($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->url !== $v) {
			$this->url = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::URL;
		}

	} 
	
	public function setSlug($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->slug !== $v) {
			$this->slug = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::SLUG;
		}

	} 
	
	public function setBlogurl($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->blogurl !== $v) {
			$this->blogurl = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::BLOGURL;
		}

	} 
	
	public function setRssurl($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->rssurl !== $v) {
			$this->rssurl = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::RSSURL;
		}

	} 
	
	public function setTwitteruser($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->twitteruser !== $v) {
			$this->twitteruser = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::TWITTERUSER;
		}

	} 
	
	public function setPhonenumber($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->phonenumber !== $v) {
			$this->phonenumber = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::PHONENUMBER;
		}

	} 
	
	public function setEmailcontact($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->emailcontact !== $v) {
			$this->emailcontact = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::EMAILCONTACT;
		}

	} 
	
	public function setRounds($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->rounds !== $v) {
			$this->rounds = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::ROUNDS;
		}

	} 
	
	public function setFounders($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->founders !== $v) {
			$this->founders = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::FOUNDERS;
		}

	} 
	
	public function setNumberemploy($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->numberemploy !== $v) {
			$this->numberemploy = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::NUMBEREMPLOY;
		}

	} 
	
	public function setLogourl($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->logourl !== $v) {
			$this->logourl = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::LOGOURL;
		}

	} 
	
	public function setPublishstate($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->publishstate !== $v) {
			$this->publishstate = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::PUBLISHSTATE;
		}

	} 
	
	public function setVersion($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->version !== $v) {
			$this->version = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::VERSION;
		}

	} 
	
	public function setStatus($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->status !== $v) {
			$this->status = $v;
			$this->modifiedColumns[] = CompanyShadowPeer::STATUS;
		}

	} 
	
	public function setCreatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->created_at !== $ts) {
			$this->created_at = $ts;
			$this->modifiedColumns[] = CompanyShadowPeer::CREATED_AT;
		}

	} 
	
	public function setUpdatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->updated_at !== $ts) {
			$this->updated_at = $ts;
			$this->modifiedColumns[] = CompanyShadowPeer::UPDATED_AT;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->company_id = $rs->getInt($startcol + 1);

			$this->name = $rs->getString($startcol + 2);

			$this->namehebrew = $rs->getString($startcol + 3);

			$this->description = $rs->getString($startcol + 4);

			$this->author_id = $rs->getInt($startcol + 5);

			$this->founded = $rs->getString($startcol + 6);

			$this->email = $rs->getString($startcol + 7);

			$this->location = $rs->getString($startcol + 8);

			$this->url = $rs->getString($startcol + 9);

			$this->slug = $rs->getString($startcol + 10);

			$this->blogurl = $rs->getString($startcol + 11);

			$this->rssurl = $rs->getString($startcol + 12);

			$this->twitteruser = $rs->getString($startcol + 13);

			$this->phonenumber = $rs->getString($startcol + 14);

			$this->emailcontact = $rs->getString($startcol + 15);

			$this->rounds = $rs->getString($startcol + 16);

			$this->founders = $rs->getString($startcol + 17);

			$this->numberemploy = $rs->getInt($startcol + 18);

			$this->logourl = $rs->getString($startcol + 19);

			$this->publishstate = $rs->getString($startcol + 20);

			$this->version = $rs->getInt($startcol + 21);

			$this->status = $rs->getInt($startcol + 22);

			$this->created_at = $rs->getTimestamp($startcol + 23, null);

			$this->updated_at = $rs->getTimestamp($startcol + 24, null);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 25; 
		} catch (Exception $e) {
			throw new PropelException("Error populating CompanyShadow object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(CompanyShadowPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			CompanyShadowPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
    if ($this->isNew() && !$this->isColumnModified(CompanyShadowPeer::CREATED_AT))
    {
      $this->setCreatedAt(time());
    }

    if ($this->isModified() && !$this->isColumnModified(CompanyShadowPeer::UPDATED_AT))
    {
      $this->setUpdatedAt(time());
    }

		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(CompanyShadowPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


												
			if ($this->aCompany !== null) {
				if ($this->aCompany->isModified()) {
					$affectedRows += $this->aCompany->save($con);
				}
				$this->setCompany($this->aCompany);
			}

			if ($this->aUser !== null) {
				if ($this->aUser->isModified()) {
					$affectedRows += $this->aUser->save($con);
				}
				$this->setUser($this->aUser);
			}


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = CompanyShadowPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += CompanyShadowPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collCompanys !== null) {
				foreach($this->collCompanys as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


												
			if ($this->aCompany !== null) {
				if (!$this->aCompany->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aCompany->getValidationFailures());
				}
			}

			if ($this->aUser !== null) {
				if (!$this->aUser->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aUser->getValidationFailures());
				}
			}


			if (($retval = CompanyShadowPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collCompanys !== null) {
					foreach($this->collCompanys as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = CompanyShadowPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getCompanyId();
				break;
			case 2:
				return $this->getName();
				break;
			case 3:
				return $this->getNamehebrew();
				break;
			case 4:
				return $this->getDescription();
				break;
			case 5:
				return $this->getAuthorId();
				break;
			case 6:
				return $this->getFounded();
				break;
			case 7:
				return $this->getEmail();
				break;
			case 8:
				return $this->getLocation();
				break;
			case 9:
				return $this->getUrl();
				break;
			case 10:
				return $this->getSlug();
				break;
			case 11:
				return $this->getBlogurl();
				break;
			case 12:
				return $this->getRssurl();
				break;
			case 13:
				return $this->getTwitteruser();
				break;
			case 14:
				return $this->getPhonenumber();
				break;
			case 15:
				return $this->getEmailcontact();
				break;
			case 16:
				return $this->getRounds();
				break;
			case 17:
				return $this->getFounders();
				break;
			case 18:
				return $this->getNumberemploy();
				break;
			case 19:
				return $this->getLogourl();
				break;
			case 20:
				return $this->getPublishstate();
				break;
			case 21:
				return $this->getVersion();
				break;
			case 22:
				return $this->getStatus();
				break;
			case 23:
				return $this->getCreatedAt();
				break;
			case 24:
				return $this->getUpdatedAt();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = CompanyShadowPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getCompanyId(),
			$keys[2] => $this->getName(),
			$keys[3] => $this->getNamehebrew(),
			$keys[4] => $this->getDescription(),
			$keys[5] => $this->getAuthorId(),
			$keys[6] => $this->getFounded(),
			$keys[7] => $this->getEmail(),
			$keys[8] => $this->getLocation(),
			$keys[9] => $this->getUrl(),
			$keys[10] => $this->getSlug(),
			$keys[11] => $this->getBlogurl(),
			$keys[12] => $this->getRssurl(),
			$keys[13] => $this->getTwitteruser(),
			$keys[14] => $this->getPhonenumber(),
			$keys[15] => $this->getEmailcontact(),
			$keys[16] => $this->getRounds(),
			$keys[17] => $this->getFounders(),
			$keys[18] => $this->getNumberemploy(),
			$keys[19] => $this->getLogourl(),
			$keys[20] => $this->getPublishstate(),
			$keys[21] => $this->getVersion(),
			$keys[22] => $this->getStatus(),
			$keys[23] => $this->getCreatedAt(),
			$keys[24] => $this->getUpdatedAt(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = CompanyShadowPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setCompanyId($value);
				break;
			case 2:
				$this->setName($value);
				break;
			case 3:
				$this->setNamehebrew($value);
				break;
			case 4:
				$this->setDescription($value);
				break;
			case 5:
				$this->setAuthorId($value);
				break;
			case 6:
				$this->setFounded($value);
				break;
			case 7:
				$this->setEmail($value);
				break;
			case 8:
				$this->setLocation($value);
				break;
			case 9:
				$this->setUrl($value);
				break;
			case 10:
				$this->setSlug($value);
				break;
			case 11:
				$this->setBlogurl($value);
				break;
			case 12:
				$this->setRssurl($value);
				break;
			case 13:
				$this->setTwitteruser($value);
				break;
			case 14:
				$this->setPhonenumber($value);
				break;
			case 15:
				$this->setEmailcontact($value);
				break;
			case 16:
				$this->setRounds($value);
				break;
			case 17:
				$this->setFounders($value);
				break;
			case 18:
				$this->setNumberemploy($value);
				break;
			case 19:
				$this->setLogourl($value);
				break;
			case 20:
				$this->setPublishstate($value);
				break;
			case 21:
				$this->setVersion($value);
				break;
			case 22:
				$this->setStatus($value);
				break;
			case 23:
				$this->setCreatedAt($value);
				break;
			case 24:
				$this->setUpdatedAt($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = CompanyShadowPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setCompanyId($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setNamehebrew($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setAuthorId($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setFounded($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setEmail($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setLocation($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setUrl($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setSlug($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setBlogurl($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setRssurl($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setTwitteruser($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setPhonenumber($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setEmailcontact($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setRounds($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setFounders($arr[$keys[17]]);
		if (array_key_exists($keys[18], $arr)) $this->setNumberemploy($arr[$keys[18]]);
		if (array_key_exists($keys[19], $arr)) $this->setLogourl($arr[$keys[19]]);
		if (array_key_exists($keys[20], $arr)) $this->setPublishstate($arr[$keys[20]]);
		if (array_key_exists($keys[21], $arr)) $this->setVersion($arr[$keys[21]]);
		if (array_key_exists($keys[22], $arr)) $this->setStatus($arr[$keys[22]]);
		if (array_key_exists($keys[23], $arr)) $this->setCreatedAt($arr[$keys[23]]);
		if (array_key_exists($keys[24], $arr)) $this->setUpdatedAt($arr[$keys[24]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(CompanyShadowPeer::DATABASE_NAME);

		if ($this->isColumnModified(CompanyShadowPeer::ID)) $criteria->add(CompanyShadowPeer::ID, $this->id);
		if ($this->isColumnModified(CompanyShadowPeer::COMPANY_ID)) $criteria->add(CompanyShadowPeer::COMPANY_ID, $this->company_id);
		if ($this->isColumnModified(CompanyShadowPeer::NAME)) $criteria->add(CompanyShadowPeer::NAME, $this->name);
		if ($this->isColumnModified(CompanyShadowPeer::NAMEHEBREW)) $criteria->add(CompanyShadowPeer::NAMEHEBREW, $this->namehebrew);
		if ($this->isColumnModified(CompanyShadowPeer::DESCRIPTION)) $criteria->add(CompanyShadowPeer::DESCRIPTION, $this->description);
		if ($this->isColumnModified(CompanyShadowPeer::AUTHOR_ID)) $criteria->add(CompanyShadowPeer::AUTHOR_ID, $this->author_id);
		if ($this->isColumnModified(CompanyShadowPeer::FOUNDED)) $criteria->add(CompanyShadowPeer::FOUNDED, $this->founded);
		if ($this->isColumnModified(CompanyShadowPeer::EMAIL)) $criteria->add(CompanyShadowPeer::EMAIL, $this->email);
		if ($this->isColumnModified(CompanyShadowPeer::LOCATION)) $criteria->add(CompanyShadowPeer::LOCATION, $this->location);
		if ($this->isColumnModified(CompanyShadowPeer::URL)) $criteria->add(CompanyShadowPeer::URL, $this->url);
		if ($this->isColumnModified(CompanyShadowPeer::SLUG)) $criteria->add(CompanyShadowPeer::SLUG, $this->slug);
		if ($this->isColumnModified(CompanyShadowPeer::BLOGURL)) $criteria->add(CompanyShadowPeer::BLOGURL, $this->blogurl);
		if ($this->isColumnModified(CompanyShadowPeer::RSSURL)) $criteria->add(CompanyShadowPeer::RSSURL, $this->rssurl);
		if ($this->isColumnModified(CompanyShadowPeer::TWITTERUSER)) $criteria->add(CompanyShadowPeer::TWITTERUSER, $this->twitteruser);
		if ($this->isColumnModified(CompanyShadowPeer::PHONENUMBER)) $criteria->add(CompanyShadowPeer::PHONENUMBER, $this->phonenumber);
		if ($this->isColumnModified(CompanyShadowPeer::EMAILCONTACT)) $criteria->add(CompanyShadowPeer::EMAILCONTACT, $this->emailcontact);
		if ($this->isColumnModified(CompanyShadowPeer::ROUNDS)) $criteria->add(CompanyShadowPeer::ROUNDS, $this->rounds);
		if ($this->isColumnModified(CompanyShadowPeer::FOUNDERS)) $criteria->add(CompanyShadowPeer::FOUNDERS, $this->founders);
		if ($this->isColumnModified(CompanyShadowPeer::NUMBEREMPLOY)) $criteria->add(CompanyShadowPeer::NUMBEREMPLOY, $this->numberemploy);
		if ($this->isColumnModified(CompanyShadowPeer::LOGOURL)) $criteria->add(CompanyShadowPeer::LOGOURL, $this->logourl);
		if ($this->isColumnModified(CompanyShadowPeer::PUBLISHSTATE)) $criteria->add(CompanyShadowPeer::PUBLISHSTATE, $this->publishstate);
		if ($this->isColumnModified(CompanyShadowPeer::VERSION)) $criteria->add(CompanyShadowPeer::VERSION, $this->version);
		if ($this->isColumnModified(CompanyShadowPeer::STATUS)) $criteria->add(CompanyShadowPeer::STATUS, $this->status);
		if ($this->isColumnModified(CompanyShadowPeer::CREATED_AT)) $criteria->add(CompanyShadowPeer::CREATED_AT, $this->created_at);
		if ($this->isColumnModified(CompanyShadowPeer::UPDATED_AT)) $criteria->add(CompanyShadowPeer::UPDATED_AT, $this->updated_at);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(CompanyShadowPeer::DATABASE_NAME);

		$criteria->add(CompanyShadowPeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setCompanyId($this->company_id);

		$copyObj->setName($this->name);

		$copyObj->setNamehebrew($this->namehebrew);

		$copyObj->setDescription($this->description);

		$copyObj->setAuthorId($this->author_id);

		$copyObj->setFounded($this->founded);

		$copyObj->setEmail($this->email);

		$copyObj->setLocation($this->location);

		$copyObj->setUrl($this->url);

		$copyObj->setSlug($this->slug);

		$copyObj->setBlogurl($this->blogurl);

		$copyObj->setRssurl($this->rssurl);

		$copyObj->setTwitteruser($this->twitteruser);

		$copyObj->setPhonenumber($this->phonenumber);

		$copyObj->setEmailcontact($this->emailcontact);

		$copyObj->setRounds($this->rounds);

		$copyObj->setFounders($this->founders);

		$copyObj->setNumberemploy($this->numberemploy);

		$copyObj->setLogourl($this->logourl);

		$copyObj->setPublishstate($this->publishstate);

		$copyObj->setVersion($this->version);

		$copyObj->setStatus($this->status);

		$copyObj->setCreatedAt($this->created_at);

		$copyObj->setUpdatedAt($this->updated_at);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getCompanys() as $relObj) {
				$copyObj->addCompany($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new CompanyShadowPeer();
		}
		return self::$peer;
	}

	
	public function setCompany($v)
	{


		if ($v === null) {
			$this->setCompanyId(NULL);
		} else {
			$this->setCompanyId($v->getId());
		}


		$this->aCompany = $v;
	}


	
	public function getCompany($con = null)
	{
		if ($this->aCompany === null && ($this->company_id !== null)) {
						include_once 'lib/model/om/BaseCompanyPeer.php';

			$this->aCompany = CompanyPeer::retrieveByPK($this->company_id, $con);

			
		}
		return $this->aCompany;
	}

	
	public function setUser($v)
	{


		if ($v === null) {
			$this->setAuthorId(NULL);
		} else {
			$this->setAuthorId($v->getId());
		}


		$this->aUser = $v;
	}


	
	public function getUser($con = null)
	{
		if ($this->aUser === null && ($this->author_id !== null)) {
						include_once 'lib/model/om/BaseUserPeer.php';

			$this->aUser = UserPeer::retrieveByPK($this->author_id, $con);

			
		}
		return $this->aUser;
	}

	
	public function initCompanys()
	{
		if ($this->collCompanys === null) {
			$this->collCompanys = array();
		}
	}

	
	public function getCompanys($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseCompanyPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collCompanys === null) {
			if ($this->isNew()) {
			   $this->collCompanys = array();
			} else {

				$criteria->add(CompanyPeer::VERSIONSHADOW, $this->getId());

				CompanyPeer::addSelectColumns($criteria);
				$this->collCompanys = CompanyPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(CompanyPeer::VERSIONSHADOW, $this->getId());

				CompanyPeer::addSelectColumns($criteria);
				if (!isset($this->lastCompanyCriteria) || !$this->lastCompanyCriteria->equals($criteria)) {
					$this->collCompanys = CompanyPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastCompanyCriteria = $criteria;
		return $this->collCompanys;
	}

	
	public function countCompanys($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseCompanyPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(CompanyPeer::VERSIONSHADOW, $this->getId());

		return CompanyPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addCompany(Company $l)
	{
		$this->collCompanys[] = $l;
		$l->setCompanyShadow($this);
	}


	
	public function getCompanysJoinUser($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseCompanyPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collCompanys === null) {
			if ($this->isNew()) {
				$this->collCompanys = array();
			} else {

				$criteria->add(CompanyPeer::VERSIONSHADOW, $this->getId());

				$this->collCompanys = CompanyPeer::doSelectJoinUser($criteria, $con);
			}
		} else {
									
			$criteria->add(CompanyPeer::VERSIONSHADOW, $this->getId());

			if (!isset($this->lastCompanyCriteria) || !$this->lastCompanyCriteria->equals($criteria)) {
				$this->collCompanys = CompanyPeer::doSelectJoinUser($criteria, $con);
			}
		}
		$this->lastCompanyCriteria = $criteria;

		return $this->collCompanys;
	}

} 